package k1_exercise;

import java.util.Scanner;

public class Loop_number {

    /**
     * 计算2/1+3/2+4/3+…+(n+1)/n，写出算法的程序
     */
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个数字：");
        int n = scanner.nextInt();

        double sum = 0;

        for (int i = 1; i <=n ; i++) {
            sum+=(i+1.0)/i;
        }
        System.out.printf("结果为：%.2f",sum);
    }
}
